package com.chufuying.tools;
import com.chufuying.tools.beans.GlobalClass;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
/**
 * 加载数据库配置文件
 * @date:2015-09-01
 * @autor:chufuying
 * @version:1.0.6
 * */
public class LoadDBconfig {
	public void loadConfig(){
		FileInputStream fis = null;	          
		Properties env = new Properties();	
		try {
			
			fis = new FileInputStream(System.getProperty("user.dir")+"//src//main//resource//dbconfig//dbconfig.properties");
			env.load(fis);
			GlobalClass.setDriver(env.getProperty("driver"));
			GlobalClass.setReadUrl(env.getProperty("readurl"));
			GlobalClass.setReadname(env.getProperty("readname"));
			GlobalClass.setReadpassword(env.getProperty("readpassword"));
			GlobalClass.setClassfilepath(env.getProperty("classfilepath"));
		} catch (Exception e) {

			e.printStackTrace();			
		}
		finally{
			try {
				if(fis != null)
					fis.close();
			} catch (IOException e) {				
				e.printStackTrace();
			}
		}
	    
	}
	
}
